package com.wy;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class LogDemo {
    // 创建Logger实例
    private static final Logger logger = LogManager.getLogger(LogDemo.class);

    public static void main(String[] args) {
        logger.info("信息日志");
        logger.warn("警告日志");
        logger.error("错误日志");

        try {
            // 模拟一些可能抛出异常的代码
            int result = 10 / 0; // 这将抛出异常
        } catch (Exception e) {
            logger.error("发生错误", e);
        }
    }
}
